package com.wangp.mywrite.coding.jindiebishiti;

import java.math.BigDecimal;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author tooStronger
 * @date 2023/5/15
 */
public class Code {

    public Code(){
    }

    public static void main(String[] args) throws InterruptedException {
//        catchError();
//        bigDecimalCode();
//        numCode();
        ExecutorService service = Executors.newFixedThreadPool(1);
        service.shutdown();
    }

    private static void numCode() {
        int a = 128;
        Integer b = 128;
        Integer c= 128;
        Long d = 128L;
        System.out.println(a==b);
        System.out.println(b==c);
        System.out.println(c.equals(d));
        System.out.println(d==a);
    }

    private static void bigDecimalCode() {
        BigDecimal bigDecimal1 = new BigDecimal("1.2");
        BigDecimal bigDecimal2 = new BigDecimal("1.20");
        System.out.println(bigDecimal1 == bigDecimal2);
        System.out.println(bigDecimal1.equals(bigDecimal2));
        System.out.println(bigDecimal1.compareTo(bigDecimal2));
        System.out.println(bigDecimal1.hashCode() == bigDecimal2.hashCode());
    }

    private static void catchError() throws InterruptedException {
        int a = 0;
        try {
            if (a == 0) {
                throw new OutOfMemoryError();
            }
        }catch (Error e){
            System.out.println("catch error");
        }
        Thread.sleep(1000L);
    }
}
